<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!doctype html>
<html class="no-js">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>待处理教练申诉</title>
<meta name="description" content="这是一个 index 页面">
<meta name="keywords" content="index">
<meta name="viewport"
	content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<meta name="renderer" content="webkit">
<meta http-equiv="Cache-Control" content="no-siteapp" />
<link rel="icon" href="images/browserLOGO2.png" type="image/x-icon" />
<link rel="apple-touch-icon-precomposed" href="assets/i/app-icon72x72@2x.png">
<meta name="apple-mobile-web-app-title" content="Amaze UI" />
<link rel="stylesheet" href="assets/css/amazeui.min.css" />
<link rel="stylesheet" href="assets/css/admin.css">
<link rel="stylesheet" href="css/layer-animate.css">
<link rel="stylesheet" href="css/profilestyle.css">
<script src="assets/js/jquery.min.js"></script>
<script src="assets/js/app.js"></script>

<style type="text/css">
.refuseButton{
	border:1px solid darkgrey;
	border-radius:10px;
	background-color: white;
	width:35px;
	background-image: url(assets/img/封号.png);
	background-repeat: no-repeat;
	background-position: center;
}
.unlockButton{
	border:1px solid darkgrey;
	border-radius:10px;
	background-color: white;
	width:35px;
	background-image: url(assets/img/解封.png);
	background-repeat: no-repeat;
	background-position: center;
}

 .boxOuter{
	width: 100%;
	text-align: center;
	height: 20px;
	margin-bottom: 3px;
	}
	
.boxInner{
	width: 50%;
	float: left;
	font-size: 20px;
	}
</style>

</head>
	<!--[if lte IE 9]><p class="browsehappy">升级你的浏览器吧！ <a href="http://se.360.cn/" target="_blank">升级浏览器</a>以获得更好的体验！</p><![endif]-->

<body>
	<!------------------------------>
	<!------------ 隐藏域  ------------>
	<!------------------------------>
	


	<!---------------------------->
	<!------------ 顶部  ------------>
	<!---------------------------->
	<%@include file="jsp/adminHeader.jsp"%>
	<!---------------------------->
	<!---------------------------->

	<div class="am-cf admin-main">

	<!--------------------------------->
	<!------------ 左侧导航栏部  ------------>
	<!---------------------------------->
	<%@include file="jsp/adminLeftNavi.jsp" %>
	<!---------------------------------->
	<!---------------------------------->

		<div class=" admin-content">

			<!----------------------------------->
			<!------------ 内容顶部导航栏  ------------>
			<!----------------------------------->
			<%@include file="jsp/adminInnerTitleNavi.jsp" %>
			<!----------------------------------->
			<!----------------------------------->

			<div class="admin-biaogelist">
				<div class="listbiaoti am-cf">
					<ul class="am-icon-flag on">待处理教练申诉</ul>
					<dl class="am-icon-home" style="float: right;">
						当前位置： <a href="index_teacher.jsp">首页</a> >
						<a href="javaScript:void(0)">消息管理</a>>
						<a href="javaScript:void(0)">教练申诉</a>>
						<a href="javaScript:void(0)">待处理教练申诉</a>
					</dl>
				</div>

				<form class="am-form am-g">
					<table width="100%" class="am-table am-table-bordered am-table-radius am-table-striped am-table-hover">
						<thead>
							<tr class="am-success">
								<th class="table-title">申诉ID</th>
								<th class="table-title">用户名</th>
								<th class="table-title">昵称</th>
								<th class="table-title">联系电话</th>
								<th class="table-author am-hide-sm-only">邮箱</th>
								<th class="table-title">封禁原因</th>
								<th class="table-title">申诉内容</th>
								<th width="130px" class="table-set" style="text-align: center;">操作</th>
							</tr>
						</thead>
						<tbody id="formList"></tbody>
					</table>

					
					<div style="width: 50%;float: right;">
						<ul class="pagination">
							<li style="float: right;list-style: none;"><a href="javaScript:void(0)" id="endPage">末页</a></li>
							<li style="float: right;list-style: none;margin-right: 5px;"><a href="javaScript:void(0)" id="nextPage">下一页</a></li>
							<li style="float: right;list-style: none;margin-right: 5px;"><span><span id="currentPage">1</span>/<span id="totalPage">1</span></span></li>
							<li style="float: right;list-style: none;margin-right: 5px;"><a href="javaScript:void(0)" id="prePage">上一页</a></li>
							<li style="float: right;list-style: none;margin-right: 5px;"><a href="javaScript:void(0)" id="beginPage" >首页</a></li>
						</ul>
					</div>

				</form>

				<!---------------------------->
				<!------------ 底部  ------------>
				<!---------------------------->
				<%@include file="jsp/adminCopyRight.jsp" %>
				<!---------------------------->
				<!---------------------------->

			</div>

		</div>

	</div>

	<!--[if lt IE 9]>
<script src="http://libs.baidu.com/jquery/1.11.1/jquery.min.js"></script>
<script src="http://cdn.staticfile.org/modernizr/2.8.3/modernizr.js"></script>
<script src="assets/js/polyfill/rem.min.js"></script>
<script src="assets/js/polyfill/respond.min.js"></script>
<script src="assets/js/amazeui.legacy.js"></script>
<![endif]-->

	<!--[if (gte IE 9)|!(IE)]><!-->
	<script src="assets/js/amazeui.min.js"></script>
	<script type="text/javascript" src="js/method.js"></script>
	<!--<![endif]-->

<script type="text/javascript">
	$(function(){
		showCoachComplain(1);
	});
	
	function showCoachComplain(ppage){     //进入页面显示所有未处理教练申诉
		$.ajax({
			url:"complain/showCoachComplain",
			type:"post",
			dataType:"json",
			data:{
				page:ppage
			},
			success:function(data){
				$("#currentPage").html(ppage);
				if(data.totalPage==0){
					$("#totalPage").html(1);
				}else{
					$("#totalPage").html(data.totalPage);
				}
				var content="";
				for(var i=0;i<data.form.length;i++){        //后台将查询到的结果放入form键中
					var po=data.form[i];
					content+='<tr>'
					+'<td>'+po.cpid+'</td>'
					+'<td>'+po.account+'</td>'
					+'<td>'+po.nickName+'</td>'
					+'<td>'+po.uphone+'</td>';
					if(po.umail=="unKnown"){
						content+='<td class="am-hide-sm-only">未完善</td>';
					}else{
						content+='<td class="am-hide-sm-only">'+po.umail+'</td>';
					}
					content+='<td class="am-hide-sm-only">'+po.lockReason+'</td>'
					+'<td class="am-hide-sm-only"><a href="javaScript:void(0)" onclick="viewComplain(\''+po.cpReason+'\')">查看</a></td>'
					+'<td style="text-align: center;">'
					+'<div class="am-btn-toolbar">'
					+'<input type="button" class="unlockButton" onclick="unlockAccount('+po.cpid+','+po.uid+',\''+po.account+'\',\''+po.lockReason+'\')" title="解封账号"/>'
					+'<input type="button" class="refuseButton" onclick="refuseComplain('+po.cpid+')" title="拒绝申诉"/>'
					+'</div>'
					+'</td>'
					+'</tr>';
				}
				$("#formList").html(content);
			}
		});
	}
	
	//拒绝申诉
	function refuseComplain(cpid){
		if(confirm("确认要拒绝该申诉请求吗？")){
			$.ajax({
				url:"user/refuseComplain",
				type:"post",
				data:{
					cpid:cpid,
				},
				success:function(data){
					alert(data);
					if(data.indexOf('成功')!=-1){
						location.reload();
					}
				}
			});
		}
	}
	
	//弹出申诉内容框
	function viewComplain(cpReason){
		var changeMes="";
		 changeMes+='<div class="container">'
			 +'<div class="boxOuter"><textarea  type="text" style="width:90%;height:250px" disabled="disabled">'+cpReason+'</textarea></div>'
			 +'<div class="boxOuter" style="margin-top:240px">'
			 +'<input type="button" class="profile-card__button button--orange" style="min-width: 150px;min-height:40px;height:40px;font-size:15px;line-height:15px;" onclick="method.msg_close()" value="关闭"/>'
			 +'</div>';
	     var obj={
	         type:"showSweetAlert",
	         title:"申诉内容",
	         content:changeMes,
	         area:["600px","400px"]
	     };
	     method.msg_layer(obj);
	}
	
	//弹出解封框
	function unlockAccount(cpid,uid,account,lockReason){
		var changeMes="";
		 changeMes+='<div class="container">'
			 +'<div class="boxOuter"><div class="boxInner">封禁账号：</div><div class="boxInner">'+account+'</div></div>'
			 +'<div class="boxOuter"><div class="boxInner">封禁原因：</div><div class="boxInner"></div></div>'
			 +'<div class="boxOuter"><textarea  type="text" style="width:65%;height:100px;border:none;background-color:none;" disabled="disabled" placeholder="'+lockReason+'"></textarea></div>'
			 +'<div class="boxOuter" style="margin-top:95px">'
			 +'<input type="button" class="profile-card__button button--blue js-message-btn" style="min-width: 150px;min-height:40px;height:40px;font-size:15px;line-height:15px;" onclick="confirmUnLock('+uid+','+cpid+')" value="确认解封"/>'
			 +'<input type="button" class="profile-card__button button--orange" style="min-width: 150px;min-height:40px;height:40px;font-size:15px;line-height:15px;" onclick="method.msg_close()" value="取消"/>'
			 +'</div>';
	     var obj={
	         type:"showSweetAlert",
	         title:"解除账户封禁",
	         content:changeMes,
	         area:["600px","300px"]
	     };
	     method.msg_layer(obj);
	}
	
	//确认解封
	function confirmUnLock(uid,cpid){
		$.ajax({
			url:"user/unLockUser",
			type:"post",
			data:{
				uid:uid,
				cpid:cpid
			},
			success:function(data){
				alert(data);
				if(data.indexOf('成功')!=-1){
					location.reload();
				}
			}
		});
	}
	
	//下一页
	$("#nextPage").click(function(){
		var currentPage=parseInt($("#currentPage").html());
		var totalPage=parseInt($("#totalPage").html());
		if(currentPage<totalPage){
			showCoachComplain(currentPage+1);
		}
	});
	
	//上一页
	$("#prePage").click(function(){
		var currentPage=parseInt($("#currentPage").html());
		if(currentPage>1){
			showCoachComplain(currentPage-1);
		}
	});
	
	//首页
	$("#beginPage").click(function(){
		var currentPage=parseInt($("#currentPage").html());
		if(currentPage!=1){
			showCoachComplain(1);
		}
		
	});
	
	//末页
	$("#endPage").click(function(){
		var currentPage=parseInt($("#currentPage").html());
		var totalPage=parseInt($("#totalPage").html());
		if(currentPage!=totalPage){
			showCoachComplain(totalPage);
		}
	});
</script>

</body>
</html>